home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 12110 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.4 KB  |  51 lines

  1. Path: erich.triumf.ca!bennett
  2. From: bennett@erich.triumf.ca (P.Bennett)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Int to Double, Pl Advise!
  5. Date: 28 Mar 1996 22:16 PST
  6. Organization: TRIUMF: Tri-University Meson Facility
  7. Distribution: world
  8. Message-ID: <28MAR199622162855@erich.triumf.ca>
  9. References: <isa5224.544.315B647A@age2.age.uiuc.edu>
  10. NNTP-Posting-Host: erich.triumf.ca
  11. News-Software: VAX/VMS VNEWS 1.50    
  12.  
  13. In article <isa5224.544.315B647A@age2.age.uiuc.edu>, isa5224@age2.age.uiuc.edu (Irfan S. Ahmad) writes...
  14. >Hi:
  15. >I am having problems with the following type conversion.  From int to double.  
  16. >If someone can comment:
  17. ....
  18. >int p0[Ng][Nr];
  19. >int main(){
  20. >int i,j,k;  
  21. >float x =0;
  22. >float y =0; 
  23.  
  24. >for (i=1; i<Ng; i++) { 
  25. >    for (j=1; j<Nr; j++) {
  26. >   
  27. >     x = x + ((double) p0[i,j]) / (double)(j*j); }
  28.                         ^^^^^
  29. This should probably be p0[i][j]
  30. >}
  31. >I get the following compilation error(s) on MS C++ compiler:
  32. >error C2440: 'cast' : cannot convert from 'int [4]' to 'double '
  33.  
  34. Peter Bennett VE7CEI                | Vessels shall be deemed to be in sight
  35. Internet: bennett@triumf.ca         | of one another only when one can be
  36. Packet: ve7cei@ve7kit.#vanc.bc.ca   | observed visually from the other
  37. TRIUMF, Vancouver, B.C., Canada     |                          ColRegs 3(k)
  38. GPS and NMEA info and programs: ftp://sundae.triumf.ca/pub/peter/index.html
  39. or: ftp://ftp-i2.informatik.rwth-aachen.de/pub/arnd/GPS/peter/index.html
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.